Micron Document
<!DOCTYPE html>
<html class="client-nojs vector-feature-night-mode-disabled vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-sticky-header-enabled" lang="en" dir="ltr"><head>
<meta charset="UTF-8">
<title>Program Segment Prefix</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="canonical" href="https://en.wikipedia.org/wiki/Program_Segment_Prefix"> <link href="./mw/ext.cite.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/ext.pygments.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.icons.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.search.codex.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/user.styles.css" rel="stylesheet" type="text/css">
<meta name="ResourceLoaderDynamicStyles" content="">
<link rel="stylesheet" type="text/css" href="./mw/site.styles.css">
<link rel="stylesheet" type="text/css" href="./mw/noscript.css">
<link rel="stylesheet" type="text/css" href="./footer.css">
<link rel="stylesheet" type="text/css" href="./vector-2022.css">
</head>
<body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-Program_Segment_Prefix rootpage-Program_Segment_Prefix skin-vector-2022 action-view">
<div class="mw-page-container">
<div class="mw-page-container-inner">
<div class="mw-content-container">
<main id="content" class="mw-body">
<header class="mw-body-header vector-page-titlebar">
<h1 id="firstHeading" class="firstHeading mw-first-heading">
<span id="openzim-page-title" class="mw-page-title-main"><span class="mw-page-title-main">Program Segment Prefix</span></span>
</h1>
</header>
<a id="top"></a>
<div id="bodyContent" class="vector-body ve-init-mw-desktopArticleTarget-targetContainer" aria-labelledby="firstHeading" data-mw-ve-target-container="">
<div id="mw-content-text" class="mw-body-content mw-content-ltr" lang="en" dir="ltr"><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr">
<p class="mw-empty-elt">

</p>
<style data-mw-deduplicate="TemplateStyles:r1044870489">
/* start https://en.wikipedia.org/ */


@media all and (max-width:720px){body.skin-minerva .mw-parser-output .tocright{display:none}.mw-parser-output .tocright{width:100%!important}}@media all and (min-width:720px){.mw-parser-output .tocright{float:right;clear:right;width:auto;margin:0 0 0.5em 1em}.mw-parser-output .tocright-clear-left{clear:left}.mw-parser-output .tocright-clear-both{clear:both}.mw-parser-output .tocright-clear-none{clear:none}}


/* end https://en.wikipedia.org/ */
</style><div class="tocright"><meta property="mw:PageProp/toc"></div>
<p>The <b>Program Segment Prefix</b> (PSP) is a data structure used in <a href="DOS" title="DOS">DOS</a> systems to store the state of a <a href="Computer_program" title="Computer program">program</a>. It resembles the <a href="Zero_page_(CP/M)" title="Zero page (CP/M)">Zero Page</a> in the <a href="CP/M" title="CP/M">CP/M</a> operating system. The PSP has the following structure:
</p>
<table border="1" width="100%" class="wikitable">
<tbody><tr>
<th>Offset
</th>
<th>Size
</th>
<th>Contents
</th></tr>
<tr>
<td>00h–01h
</td>
<td>2 bytes (code)
</td>
<td><a href="CP/M-80" class="mw-redirect" title="CP/M-80">CP/M-80</a>-like exit (always contains <a href="DOS_API#Interrupt_vectors_used_by_DOS" title="DOS API">INT 20h</a>)<sup id="cite_ref-Taylor_1982_Translators_1-0" class="reference"><a href="#cite_note-Taylor_1982_Translators-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-Paul_2002_COM_2-0" class="reference"><a href="#cite_note-Paul_2002_COM-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup>
</td></tr>
<tr>
<td>02h–03h
</td>
<td><a href="Word_(data_type)" class="mw-redirect" title="Word (data type)">word</a> (2 bytes)
</td>
<td>Segment of the first byte beyond the memory allocated to the program
</td></tr>
<tr>
<td>04h
</td>
<td>byte
</td>
<td>Reserved
</td></tr>
<tr>
<td>05h–09h
</td>
<td>5 bytes (code)
</td>
<td><a href="CALL_5_(PSP)" class="mw-redirect" title="CALL 5 (PSP)">CP/M-80-like</a> far call entry into DOS, and program segment size<sup id="cite_ref-Taylor_1982_Translators_1-1" class="reference"><a href="#cite_note-Taylor_1982_Translators-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-Necasek_2011_CALL5_3-0" class="reference"><a href="#cite_note-Necasek_2011_CALL5-3"><span class="cite-bracket">[</span>3<span class="cite-bracket">]</span></a></sup>
</td></tr>
<tr>
<td>0Ah–0Dh
</td>
<td><a href="Dword" class="mw-redirect" title="Dword">dword</a> (4 bytes)
</td>
<td>Terminate address of previous program (old <a href="DOS_API#Interrupt_vectors_used_by_DOS" title="DOS API">INT 22h</a>)
</td></tr>
<tr>
<td>0Eh–11h
</td>
<td>dword
</td>
<td>Break address of previous program (old <a href="DOS_API#Interrupt_vectors_used_by_DOS" title="DOS API">INT 23h</a>)
</td></tr>
<tr>
<td>12h–15h
</td>
<td>dword
</td>
<td>Critical error address of previous program (old <a href="DOS_API#Interrupt_vectors_used_by_DOS" title="DOS API">INT 24h</a>)
</td></tr>
<tr>
<td>16h–17h
</td>
<td>word
</td>
<td>Parent's PSP segment (usually <a href="COMMAND.COM" title="COMMAND.COM">COMMAND.COM</a> - internal)
</td></tr>
<tr>
<td>18h–2Bh
</td>
<td>20 bytes
</td>
<td><a href="Job_File_Table" title="Job File Table">Job File Table</a> (JFT) (internal)
</td></tr>
<tr>
<td>2Ch–2Dh
</td>
<td>word
</td>
<td><a href="Environment_variable" title="Environment variable">Environment</a> segment
</td></tr>
<tr>
<td>2Eh–31h
</td>
<td>dword
</td>
<td>SS:SP on entry to last <a href="INT_21h" class="mw-redirect" title="INT 21h">INT 21h</a> call (internal)
</td></tr>
<tr>
<td>32h–33h
</td>
<td>word
</td>
<td>JFT size (internal)
</td></tr>
<tr>
<td>34h–37h
</td>
<td>dword
</td>
<td>Pointer to JFT (internal)
</td></tr>
<tr>
<td>38h–3Bh
</td>
<td>dword
</td>
<td>Pointer to previous PSP (only used by SHARE in DOS 3.3 and later)
</td></tr>
<tr>
<td>3Ch–3Fh
</td>
<td>4 bytes
</td>
<td>Reserved
</td></tr>
<tr>
<td>40h–41h
</td>
<td>word
</td>
<td>DOS version to return (DOS 5 and later, alterable via SETVER in DOS 5 and later)
</td></tr>
<tr>
<td>42h–4Fh
</td>
<td>14 bytes
</td>
<td>Reserved
</td></tr>
<tr>
<td>50h–52h
</td>
<td>3 bytes (code)
</td>
<td><a href="Unix" title="Unix">Unix</a>-like far call entry into DOS (always contains INT 21h + RETF)
</td></tr>
<tr>
<td>53h–54h
</td>
<td>2 bytes
</td>
<td>Reserved
</td></tr>
<tr>
<td>55h–5Bh
</td>
<td>7 bytes
</td>
<td>Reserved (can be used to make first FCB into an extended FCB)
</td></tr>
<tr>
<td>5Ch–6Bh
</td>
<td>16 bytes
</td>
<td>Unopened Standard <a href="File_control_block" class="mw-redirect" title="File control block">FCB</a> 1
</td></tr>
<tr>
<td>6Ch–7Fh
</td>
<td>20 bytes
</td>
<td>Unopened Standard FCB 2 (overwritten if FCB 1 is opened)
</td></tr>
<tr>
<td>80h
</td>
<td>1 byte
</td>
<td>Number of bytes on command-line
</td></tr>
<tr>
<td>81h–FFh
</td>
<td>127 bytes
</td>
<td>Command-line tail (terminated by a <a href="Carriage_return" title="Carriage return">0Dh</a>)<sup id="cite_ref-Paul_1997_MSDOS_4-0" class="reference"><a href="#cite_note-Paul_1997_MSDOS-4"><span class="cite-bracket">[</span>4<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-Paul_1997_4DOSTIP_5-0" class="reference"><a href="#cite_note-Paul_1997_4DOSTIP-5"><span class="cite-bracket">[</span>5<span class="cite-bracket">]</span></a></sup>
</td></tr></tbody></table>
<p>The PSP is most often used to get the <a href="Argc" class="mw-redirect" title="Argc">command line arguments</a> of a DOS program; for example, the command "FOO.EXE /A /F" executes FOO.EXE with the arguments '/A' and '/F'.
</p><p>If the PSP entry for the command line length is non-zero and the pointer to the environment segment is neither 0000h nor FFFFh, programs should first try to retrieve the command line from the <a href="Environment_variable" title="Environment variable">environment variable</a> <a href="%25CMDLINE%25" class="mw-redirect" title="%CMDLINE%">%CMDLINE%</a> before extracting it from the PSP. This way, it is possible to pass command lines longer than 126 characters to applications.
</p><p>The segment address of the PSP is passed in the DS register when the program is executed. It can also be determined later by using Int 21h function 51h or Int 21h function 62h. Either function will return the PSP address in register BX.<sup id="cite_ref-R1_6-0" class="reference"><a href="#cite_note-R1-6"><span class="cite-bracket">[</span>6<span class="cite-bracket">]</span></a></sup>
</p><p>Alternatively, in <a href=".COM" class="mw-redirect" title=".COM">.COM</a> programs loaded at offset <code>100h</code>, one can address the PSP directly just by using the offsets listed above. Offset <code>000h</code> points to the beginning of the PSP, <code>0FFh</code> points to the end, etc.
</p><p>For example, the following code displays the command line arguments:
</p>
<div class="mw-highlight mw-highlight-lang-nasm mw-content-ltr" dir="ltr"><pre><span class="k">org</span><span class="w"> </span><span class="mh">100h</span><span class="w"> </span><span class="c1">; .COM - not using ds</span>

<span class="c1">; INT 21h subfunction 9 requires '$' to terminate string</span>
<span class="nf">xor</span><span class="w"> </span><span class="nb">bx</span><span class="p">,</span><span class="nb">bx</span>
<span class="nf">mov</span><span class="w"> </span><span class="nb">bl</span><span class="p">,[</span><span class="mh">80h</span><span class="p">]</span>
<span class="nf">cmp</span><span class="w"> </span><span class="nb">bl</span><span class="p">,</span><span class="mh">7Eh</span>
<span class="w"> </span><span class="nf">ja</span><span class="w"> </span><span class="nv">exit</span><span class="w"> </span><span class="c1">; preventing overflow</span>

<span class="nf">mov</span><span class="w"> </span><span class="kt">byte</span><span class="w"> </span><span class="p">[</span><span class="nb">bx</span><span class="o">+</span><span class="mh">81h</span><span class="p">],</span><span class="s">'$'</span>

<span class="c1">; print the string</span>
<span class="nf">mov</span><span class="w"> </span><span class="nb">ah</span><span class="p">,</span><span class="mi">9</span>
<span class="nf">mov</span><span class="w"> </span><span class="nb">dx</span><span class="p">,</span><span class="mh">81h</span>
<span class="nf">int</span><span class="w"> </span><span class="mh">21h</span>

<span class="nl">exit:</span>
<span class="nf">mov</span><span class="w"> </span><span class="nb">ax</span><span class="p">,</span><span class="mh">4C00h</span><span class="w"> </span><span class="c1">; subfunction 4C</span>
<span class="nf">int</span><span class="w"> </span><span class="mh">21h</span>
</pre></div>
<p>In DOS 1.x, it was necessary for the CS (Code Segment) register to contain the same segment as the PSP at program termination, thus standard programming practice involved saving the DS register (since the DS register is loaded with the PSP segment) along with a zero word to the stack at program start and terminating the program with a RETF instruction, which would pop the saved segment value off the stack and jump to address 0 of the PSP, which contained an INT 20h instruction.
</p>
<div class="mw-highlight mw-highlight-lang-nasm mw-content-ltr" dir="ltr"><pre><span class="c1">; save</span>
<span class="nf">push</span><span class="w"> </span><span class="nb">ds</span>
<span class="nf">xor</span><span class="w"> </span><span class="nb">ax</span><span class="p">,</span><span class="nb">ax</span>
<span class="nf">push</span><span class="w"> </span><span class="nb">ax</span>

<span class="c1">; move to the default data group (@data)</span>
<span class="nf">mov</span><span class="w"> </span><span class="nb">ax</span><span class="p">,</span><span class="err">@</span><span class="nv">data</span>
<span class="nf">mov</span><span class="w"> </span><span class="nb">ds</span><span class="p">,</span><span class="nb">ax</span>

<span class="c1">; print message in mess1 (21h subfunction 9)</span>
<span class="nf">mov</span><span class="w"> </span><span class="nb">dx</span><span class="p">,</span><span class="nv">mess1</span>
<span class="nf">mov</span><span class="w"> </span><span class="nb">ah</span><span class="p">,</span><span class="mi">9</span>
<span class="nf">int</span><span class="w"> </span><span class="mh">21h</span>

<span class="nf">retf</span>
</pre></div>
<p>If the executable was a .COM file, this procedure was unnecessary and the program could be terminated merely with a direct INT 20h instruction or else calling INT 21h function 0. However, the programmer still had to ensure that the CS register contained the segment address of the PSP at program termination. Thus,
</p>
<div class="mw-highlight mw-highlight-lang-nasm mw-content-ltr" dir="ltr"><pre><span class="nf">jmp</span><span class="w"> </span><span class="nv">start</span>

<span class="nf">mess1</span><span class="w"> </span><span class="nv">db</span><span class="w"> </span><span class="s">'Hello world!$'</span>

<span class="nl">start:</span>
<span class="nf">mov</span><span class="w"> </span><span class="nb">dx</span><span class="p">,</span><span class="nv">mess1</span>
<span class="nf">mov</span><span class="w"> </span><span class="nb">ah</span><span class="p">,</span><span class="mi">9</span>
<span class="nf">int</span><span class="w"> </span><span class="mh">21h</span>

<span class="nf">int</span><span class="w"> </span><span class="mh">20h</span>
</pre></div>
<p>In DOS 2.x and higher, program termination was accomplished instead with INT 21h function 4Ch which did not require the CS register to contain the segment value of the PSP.
</p>
<div class="mw-heading mw-heading2"><h2 id="See_also">See also</h2></div>
<ul><li><a href="Zero_page_(CP/M)" title="Zero page (CP/M)">Zero page (CP/M)</a></li>
<li><a href="CALL_5_(DOS)" class="mw-redirect" title="CALL 5 (DOS)">CALL 5 (DOS)</a></li>
<li><a href="Stack_frame" class="mw-redirect" title="Stack frame">Stack frame</a> (Unix)<sup id="cite_ref-Schulman_1994_Undocumented-DOS_7-0" class="reference"><a href="#cite_note-Schulman_1994_Undocumented-DOS-7"><span class="cite-bracket">[</span>7<span class="cite-bracket">]</span></a></sup></li>
<li>Process directory (Multics)<sup id="cite_ref-Schulman_1994_Undocumented-DOS_7-1" class="reference"><a href="#cite_note-Schulman_1994_Undocumented-DOS-7"><span class="cite-bracket">[</span>7<span class="cite-bracket">]</span></a></sup></li>
<li><a href="Process_identifier" title="Process identifier">Process identifier</a> (PID)<sup id="cite_ref-Schulman_1994_Undocumented-DOS_7-2" class="reference"><a href="#cite_note-Schulman_1994_Undocumented-DOS-7"><span class="cite-bracket">[</span>7<span class="cite-bracket">]</span></a></sup></li>
<li><a href="This_(computer_programming)" title="This (computer programming)">this (computer programming)</a></li>
<li><a href="Self-reference" title="Self-reference">Self-reference</a></li></ul>
<div class="mw-heading mw-heading2"><h2 id="References">References</h2></div>
<style data-mw-deduplicate="TemplateStyles:r1239543626">
/* start https://en.wikipedia.org/ */


.mw-parser-output .reflist{margin-bottom:0.5em;list-style-type:decimal}@media screen{.mw-parser-output .reflist{font-size:90%}}.mw-parser-output .reflist .references{font-size:100%;margin-bottom:0;list-style-type:inherit}.mw-parser-output .reflist-columns-2{column-width:30em}.mw-parser-output .reflist-columns-3{column-width:25em}.mw-parser-output .reflist-columns{margin-top:0.3em}.mw-parser-output .reflist-columns ol{margin-top:0}.mw-parser-output .reflist-columns li{page-break-inside:avoid;break-inside:avoid-column}.mw-parser-output .reflist-upper-alpha{list-style-type:upper-alpha}.mw-parser-output .reflist-upper-roman{list-style-type:upper-roman}.mw-parser-output .reflist-lower-alpha{list-style-type:lower-alpha}.mw-parser-output .reflist-lower-greek{list-style-type:lower-greek}.mw-parser-output .reflist-lower-roman{list-style-type:lower-roman}


/* end https://en.wikipedia.org/ */
</style><div class="reflist">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-Taylor_1982_Translators-1"><span class="mw-cite-backlink">^ <a href="#cite_ref-Taylor_1982_Translators_1-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-Taylor_1982_Translators_1-1"><sup><i><b>b</b></i></sup></a></span> <span class="reference-text"><style data-mw-deduplicate="TemplateStyles:r1238218222">
/* start https://en.wikipedia.org/ */


.mw-parser-output cite.citation{font-style:inherit;word-wrap:break-word}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}.mw-parser-output .id-lock-free.id-lock-free a{background:url("./mw/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited.id-lock-limited a,.mw-parser-output .id-lock-registration.id-lock-registration a{background:url("./mw/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription.id-lock-subscription a{background:url("./mw/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-ws-icon a{background:url("./mw/Wikisource-logo.svg")right 0.1em center/12px no-repeat}body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-free a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-limited a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-registration a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-subscription a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .cs1-ws-icon a{background-size:contain;padding:0 1em 0 0}.mw-parser-output .cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;color:var(--color-error,#d33)}.mw-parser-output .cs1-visible-error{color:var(--color-error,#d33)}.mw-parser-output .cs1-maint{display:none;color:#085;margin-left:0.3em}.mw-parser-output .cs1-kern-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}@media screen{.mw-parser-output .cs1-format{font-size:95%}html.skin-theme-clientpref-night .mw-parser-output .cs1-maint{color:#18911f}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .cs1-maint{color:#18911f}}


/* end https://en.wikipedia.org/ */
</style><cite id="CITEREFTaylorLemmons1982" class="citation magazine cs1">Taylor, Roger; Lemmons, Phil (June 1982). <a rel="nofollow" class="external text" href="https://tech-insider.org/personal-computers/research/acrobat/8206-b.pdf">"Upward migration - Part 1: Translators - Using translation programs to move CP/M-86 programs to CP/M and MS-DOS"</a> [Using translation programs to move CP/M programs to CP/M-86 and MS-DOS] <span class="cs1-format">(PDF)</span>. <i><a href="BYTE" class="mw-redirect" title="BYTE">BYTE</a></i>. Vol.&nbsp;7, no.&nbsp;6. <a href="BYTE_Publications_Inc." class="mw-redirect" title="BYTE Publications Inc.">BYTE Publications Inc.</a> pp.&nbsp;<span class="nowrap">321–</span>322, 324, 326, 328, 330, 332, 334, 336, 338, 340, 342, 344 [342, 344]. <a href="ISSN_(identifier)" class="mw-redirect" title="ISSN (identifier)">ISSN</a>&nbsp;<a rel="nofollow" class="external text" href="https://search.worldcat.org/issn/0360-5280">0360-5280</a>. <a href="CODEN_(identifier)" class="mw-redirect" title="CODEN (identifier)">CODEN</a>&nbsp;<a rel="nofollow" class="external text" href="https://cassi.cas.org/searching.jsp?searchIn=codens&amp;exactMatch=y&amp;c=WIy460-R_DY&amp;searchFor=BYTEDJ">BYTEDJ</a>. <a rel="nofollow" class="external text" href="https://web.archive.org/web/20200116024623/https://tech-insider.org/personal-computers/research/acrobat/8206-b.pdf">Archived</a> <span class="cs1-format">(PDF)</span> from the original on 2020-01-16<span class="reference-accessdate">. Retrieved <span class="nowrap">2020-01-15</span></span>. <q>[…] Gaining Access to <a href="CP/M-86" title="CP/M-86">CP/M-86</a> […] Gaining access to CP/M-86 requires placing the function code in the CL register, placing the byte parameter in the DL register or placing the word parameter in the DX register, placing the data segment in the DS register (the data segment is usually not changed for a converted program), and executing a software interrupt, <a href="INT_E0h" class="mw-redirect" title="INT E0h">INT #224</a>. The result is returned in the AL register if it is a byte value; if the result is a word value, it is returned in both the AX and BX registers. Double-word values are returned with the offset in the BX registers and the segment in the ES register. Conversion of programs from <a href="CP/M-80" class="mw-redirect" title="CP/M-80">CP/M-80</a> to CP/M-86, then, requires replacing the call to location 5 with the software interrupt INT #224. Another necessary change involves the <a href="Warm_boot" class="mw-redirect" title="Warm boot">warm boot</a>. Under CP/M-80, the warm boot may be accessed by a system call with a function code of 0 for a jump to location 0. CP/M-86, however, does not support the jump to location 0. As a result, you must change this program exit in the translated program if the program is to run correctly. Provided that the call to location 5 is replaced with INT #224, that the warm boot change is made, and that the registers are mapped correctly, there should be little problem in getting the translated program to access the CP/M-86 system functions. […] Gaining Access to <a href="MS-DOS" title="MS-DOS">MS-DOS</a> […] Although MS-DOS has a "preferred" mechanism through a soft-ware interrupt, <a href="INT_21h" class="mw-redirect" title="INT 21h">INT #33</a>, for accessing the system, an additional mechanism is provided for "preexisting" programs that is compatible with CP/M-80 calling conventions, at least for functions in the range of 0-36. As far as system calls within the allowed function range are concerned, the programmer doesn't have to do anything to translated programs to get them to run under MS-DOS other than to correctly map the registers. MS-DOS also supports the warm boot function of CP/M-80. A jump to location 0 under MS-DOS executes a software interrupt, <a href="INT_20h" class="mw-redirect" title="INT 20h">INT #32</a>, which is functionally a program end and the normal way to exit from a program. […]</q></cite> <a rel="nofollow" class="external autonumber" href="https://archive.org/details/byte-magazine-1982-06">[1]</a> <a rel="nofollow" class="external autonumber" href="https://www.americanradiohistory.com/hd2/IDX-Consumer/Archive-Byte-IDX/IDX/80s/82-83/Byte-1982-06-OCR-Page-0323.pdf">[2]</a><a rel="nofollow" class="external autonumber" href="https://www.americanradiohistory.com/hd2/IDX-Consumer/Archive-Byte-IDX/IDX/80s/82-83/Byte-1982-06-OCR-Page-0324.pdf">[3]</a><a rel="nofollow" class="external autonumber" href="https://www.americanradiohistory.com/hd2/IDX-Consumer/Archive-Byte-IDX/IDX/80s/82-83/Byte-1982-06-OCR-Page-0326.pdf">[4]</a><a rel="nofollow" class="external autonumber" href="https://www.americanradiohistory.com/hd2/IDX-Consumer/Archive-Byte-IDX/IDX/80s/82-83/Byte-1982-06-OCR-Page-0328.pdf">[5]</a><a rel="nofollow" class="external autonumber" href="https://www.americanradiohistory.com/hd2/IDX-Consumer/Archive-Byte-IDX/IDX/80s/82-83/Byte-1982-06-OCR-Page-0330.pdf">[6]</a><a rel="nofollow" class="external autonumber" href="https://www.americanradiohistory.com/hd2/IDX-Consumer/Archive-Byte-IDX/IDX/80s/82-83/Byte-1982-06-OCR-Page-0332.pdf">[7]</a><a rel="nofollow" class="external autonumber" href="https://www.americanradiohistory.com/hd2/IDX-Consumer/Archive-Byte-IDX/IDX/80s/82-83/Byte-1982-06-OCR-Page-0334.pdf">[8]</a><a rel="nofollow" class="external autonumber" href="https://www.americanradiohistory.com/hd2/IDX-Consumer/Archive-Byte-IDX/IDX/80s/82-83/Byte-1982-06-OCR-Page-0336.pdf">[9]</a><a rel="nofollow" class="external autonumber" href="https://www.americanradiohistory.com/hd2/IDX-Consumer/Archive-Byte-IDX/IDX/80s/82-83/Byte-1982-06-OCR-Page-0338.pdf">[10]</a><a rel="nofollow" class="external autonumber" href="https://www.americanradiohistory.com/hd2/IDX-Consumer/Archive-Byte-IDX/IDX/80s/82-83/Byte-1982-06-OCR-Page-0340.pdf">[11]</a><a rel="nofollow" class="external autonumber" href="https://www.americanradiohistory.com/hd2/IDX-Consumer/Archive-Byte-IDX/IDX/80s/82-83/Byte-1982-06-OCR-Page-0342.pdf">[12]</a><a rel="nofollow" class="external autonumber" href="https://www.americanradiohistory.com/hd2/IDX-Consumer/Archive-Byte-IDX/IDX/80s/82-83/Byte-1982-06-OCR-Page-0344.pdf">[13]</a><a rel="nofollow" class="external autonumber" href="https://www.americanradiohistory.com/hd2/IDX-Consumer/Archive-Byte-IDX/IDX/80s/82-83/Byte-1982-06-OCR-Page-0346.pdf">[14]</a> (13 pages)</span>
</li>
<li id="cite_note-Paul_2002_COM-2"><span class="mw-cite-backlink"><b><a href="#cite_ref-Paul_2002_COM_2-0">^</a></b></span> <span class="reference-text"><cite id="CITEREFPaul2002" class="citation newsgroup cs1">Paul, Matthias R. (2002-10-07) [2000]. <a rel="nofollow" class="external text" href="https://groups.google.com/d/msg/alt.msdos.programmer/d7blJjY0H5M/Qu3VeTOIGVcJ">"Re: Run a COM file"</a>. <a href="Usenet_newsgroup" title="Usenet newsgroup">Newsgroup</a>:&nbsp;<a rel="nofollow" class="external text" href="news:alt.msdos.programmer">alt.msdos.programmer</a>. <a rel="nofollow" class="external text" href="https://archive.today/20170903230312/https://groups.google.com/forum/%23!msg/alt.msdos.programmer/d7blJjY0H5M/Qu3VeTOIGVcJ">Archived</a> from the original on 2017-09-03<span class="reference-accessdate">. Retrieved <span class="nowrap">2017-09-03</span></span>.</cite> <a rel="nofollow" class="external autonumber" href="https://groups.google.com/d/msg/alt.lang.asm/PNOd9zfYow0/vXbab16j4XwJ">[15]</a> (NB. Has details on DOS COM program calling conventions.)</span>
</li>
<li id="cite_note-Necasek_2011_CALL5-3"><span class="mw-cite-backlink"><b><a href="#cite_ref-Necasek_2011_CALL5_3-0">^</a></b></span> <span class="reference-text"><cite id="CITEREFNecasek2011" class="citation web cs1">Necasek, Michal (2011-09-13). <a rel="nofollow" class="external text" href="http://www.os2museum.com/wp/who-needs-the-address-wraparound-anyway/">"Who needs the address wraparound, anyway?"</a>. <i>OS/2 Museum</i>. <a rel="nofollow" class="external text" href="https://web.archive.org/web/20200219004644/http://www.os2museum.com/wp/who-needs-the-address-wraparound-anyway/">Archived</a> from the original on 2020-02-19<span class="reference-accessdate">. Retrieved <span class="nowrap">2020-02-19</span></span>. <q>[…] <a href="86-DOS" title="86-DOS">86-DOS</a>, and hence <a href="PC_DOS" class="mw-redirect" title="PC DOS">PC&nbsp;DOS</a>/<a href="MS-DOS" title="MS-DOS">MS-DOS</a>, used a clever trick. The byte at offset 5 of the PSP contained a far call opcode (9Ah); the word at offset 6 of the PSP contained the appropriate value to indicate program segment size, and also the offset part of the far call. The word at offset 8, which served as the segment part of the far call, was crafted such that when combined with the offset, it would wrap around (a well understood feature of the <a href="8086" class="mw-redirect" title="8086">8086</a> CPU) and point to address 0:C0h, which contains interrupt vector 30h. […] the <a href="CALL_5_(DOS)" class="mw-redirect" title="CALL 5 (DOS)">CALL 5</a> interface works even in DOS emulation under Windows NT and OS/2, and those systems most certainly cannot run with the <a href="A20_line" title="A20 line">A20 line</a> disabled. How does that work then? […] Rather than chopping off address bits, the system mirrors the five bytes at 0:C0h at 1000C0h. The same technique had been in fact used in DOS 5 and above running with <a href="DOS_(CONFIG.SYS_directive)" class="mw-redirect" title="DOS (CONFIG.SYS directive)">DOS=HIGH</a>. In that case, DOS makes sure that linear address 1000C0h contains the appropriate far call. […]</q></cite></span>
</li>
<li id="cite_note-Paul_1997_MSDOS-4"><span class="mw-cite-backlink"><b><a href="#cite_ref-Paul_1997_MSDOS_4-0">^</a></b></span> <span class="reference-text"><cite id="CITEREFPaul1997" class="citation book cs1 cs1-prop-foreign-lang-source">Paul, Matthias R. (1997-07-01) [1994-01-01]. <a rel="nofollow" class="external text" href="http://www.antonis.de/dos/dos-tuts/mpdostip/html/msdostip.htm"><i>MSDOSTIPs — Tips für den Umgang mit MS-DOS 5.0-7</i></a> (in German). <a rel="nofollow" class="external text" href="https://web.archive.org/web/20170822214030/http://www.antonis.de/dos/dos-tuts/mpdostip/html/msdostip.htm">Archived</a> from the original on 2017-08-22<span class="reference-accessdate">. Retrieved <span class="nowrap">2013-10-25</span></span>.</cite> <span class="cs1-visible-error citation-comment"><code class="cs1-code">{{cite book}}</code>: </span><span class="cs1-visible-error citation-comment"><code class="cs1-code">|work=</code> ignored (help)</span> (NB. MSDOSTIP.TXT is part of MPDOSTIP.ZIP, maintained up to 2001 and distributed on many sites at the time. The provided link points to a HTML-converted older version of the MSDOSTIP.TXT file.) <a rel="nofollow" class="external autonumber" href="https://web.archive.org/web/20190601152204/https://www.sac.sk/download/text/mpdostip.zip">[16]</a></span>
</li>
<li id="cite_note-Paul_1997_4DOSTIP-5"><span class="mw-cite-backlink"><b><a href="#cite_ref-Paul_1997_4DOSTIP_5-0">^</a></b></span> <span class="reference-text"><cite id="CITEREFPaul1997" class="citation web cs1 cs1-prop-foreign-lang-source">Paul, Matthias R. (1997-05-01) [1995-03-01]. <a rel="nofollow" class="external text" href="http://www.antonis.de/dos/dos-tuts/mpdostip/html/4dostip.htm">"Hinweise zu JPSofts 4DOS 5.5b/c, 5.51, 5.52a und NDOS"</a>. <i>MPDOSTIP</i> (in German). <a rel="nofollow" class="external text" href="https://web.archive.org/web/20161104211143/http://www.antonis.de/dos/dos-tuts/mpdostip/html/4dostip.htm">Archived</a> from the original on 2016-11-04<span class="reference-accessdate">. Retrieved <span class="nowrap">2015-05-08</span></span>.</cite> (NB. The provided link points to a HTML-converted version of the <code>4DOS5TIP.TXT</code> file, which is part of the <code>MPDOSTIP.ZIP</code> collection.) <a rel="nofollow" class="external autonumber" href="https://web.archive.org/web/20190601152204/https://www.sac.sk/download/text/mpdostip.zip">[17]</a></span>
</li>
<li id="cite_note-R1-6"><span class="mw-cite-backlink"><b><a href="#cite_ref-R1_6-0">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://web.archive.org/web/20120207062050/http://www.htl-steyr.ac.at/~morg/pcinfo/hardware/interrupts/inte8fjk.htm">"INT 21h,62h - Get PSP address (DOS 3.x)"</a>. Archived from <a rel="nofollow" class="external text" href="http://www.htl-steyr.ac.at/~morg/pcinfo/hardware/interrupts/inte8fjk.htm">the original</a> on 2012-02-07.</cite></span>
</li>
<li id="cite_note-Schulman_1994_Undocumented-DOS-7"><span class="mw-cite-backlink">^ <a href="#cite_ref-Schulman_1994_Undocumented-DOS_7-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-Schulman_1994_Undocumented-DOS_7-1"><sup><i><b>b</b></i></sup></a> <a href="#cite_ref-Schulman_1994_Undocumented-DOS_7-2"><sup><i><b>c</b></i></sup></a></span> <span class="reference-text"><cite id="CITEREFSchulmanBrownMaxeyMichels1994" class="citation book cs1">Schulman, Andrew; <a href="Ralf_D._Brown" class="mw-redirect" title="Ralf D. Brown">Brown, Ralf D.</a>; Maxey, David; Michels, Raymond J.; Kyle, Jim (1994) [November 1993]. <span class="id-lock-registration" title="Free registration required"><a rel="nofollow" class="external text" href="https://archive.org/details/undocumenteddosp00andr_0"><i>Undocumented DOS: A programmer's guide to reserved MS-DOS functions and data structures - expanded to include MS-DOS 6, Novell DOS and Windows 3.1</i></a></span> (2&nbsp;ed.). Reading, Massachusetts, USA: <a href="Addison_Wesley" class="mw-redirect" title="Addison Wesley">Addison Wesley</a>. <a href="ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a>&nbsp;<bdi>0-201-63287-X</bdi>.</cite> (xviii+856+vi pages, 3.5"-floppy) Errata: <a rel="nofollow" class="external autonumber" href="https://web.archive.org/web/20190417215556/http://www.cs.cmu.edu/afs/cs/user/ralf/pub/books/UndocumentedDOS/errata.ud2">[18]</a><a rel="nofollow" class="external autonumber" href="https://web.archive.org/web/20190417212906/https://www.pcjs.org/pubs/pc/programming/Undocumented_DOS/#errata-2nd-edition">[19]</a></span>
</li>
</ol></div></div>
<div class="mw-heading mw-heading2"><h2 id="Further_reading">Further reading</h2></div>
<ul><li><cite class="citation book cs1"><a rel="nofollow" class="external text" href="https://web.archive.org/web/20190623112725/http://www.patersontech.com/dos/Docs/86_dos_prog.pdf"><i>86-DOS - Disk Operating System for the 8086 - Programmer's Manual</i></a> <span class="cs1-format">(PDF)</span>. Version 0.3 (Preliminary&nbsp;ed.). Seattle, Washington, USA: <a href="Seattle_Computer_Products%2C_Inc." class="mw-redirect" title="Seattle Computer Products, Inc.">Seattle Computer Products, Inc.</a> 1980. Archived from <a rel="nofollow" class="external text" href="http://www.patersontech.com/dos/Docs/86_dos_prog.pdf">the original</a> <span class="cs1-format">(PDF)</span> on 2019-06-23<span class="reference-accessdate">. Retrieved <span class="nowrap">2011-09-13</span></span>.</cite> (41 pages)</li>
<li><cite class="citation web cs1"><a rel="nofollow" class="external text" href="http://www.delorie.com/djgpp/doc/rbinter/it/78/13.html">"Format of Program Segment Prefix (PSP)"</a>. <i><a href="INTER61" class="mw-redirect" title="INTER61">INTER61</a></i>. 2000. <a rel="nofollow" class="external text" href="https://web.archive.org/web/20200217223939/http://www.delorie.com/djgpp/doc/rbinter/it/78/13.html">Archived</a> from the original on 2020-02-17<span class="reference-accessdate">. Retrieved <span class="nowrap">2019-12-19</span></span>.</cite></li>
<li><cite id="CITEREFSchäpers1991" class="citation book cs1 cs1-prop-foreign-lang-source">Schäpers, Arne (1991). "Kapitel 5: EXEC im Detail - Program Segment Prefix (PSP)". <i>DOS 5 für Programmierer: Die endgültige Referenz</i> (in German) (1&nbsp;ed.). <a href="Addison_Wesley_(Deutschland)_GmbH" class="mw-redirect" title="Addison Wesley (Deutschland) GmbH">Addison Wesley (Deutschland) GmbH</a>. pp.&nbsp;<span class="nowrap">148–</span>151, <span class="nowrap">971–</span>972. <a href="ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a>&nbsp;<bdi>3-89319-350-2</bdi>.</cite> (1123+v pages, foldout, 5.25"-floppy)</li></ul>
<div class="mw-heading mw-heading2"><h2 id="External_links">External links</h2></div>
<ul><li><a rel="nofollow" class="external text" href="http://support.microsoft.com/kb/123729">Accessing Command Line Arguments</a> (Microsoft.com)</li></ul></div><!--htdig_noindex--><div><div class="zim-footer">
This article is issued from <a class="external text" title="Last edited on 2025-04-03" href="https://en.wikipedia.org/wiki/?title=Program_Segment_Prefix&amp;oldid=1283684272">Wikipedia</a>. The text is available under <a class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en">Creative Commons Attribution-Share Alike 4.0</a> unless otherwise noted. Additional terms may apply for the media files.
</div>
</div><!--/htdig_noindex--></div>
</div>
</main>
</div>
</div>
</div>

</body></html>